home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
401_500
/
DISK0417
/
DISK0417.ZIP
/
PROLOG.ARC
/
EXPERT.ARC
/
GENIAL.PRO
< prev
next >
Wrap
Text File
|
1986-09-08
|
10KB
|
308 lines
write( 'GENIAL --- 9/8/86' ).
write( 'Prof. James Boster' ).
write( 'Dept. of Anthropology' ).
write( 'University of Pittsburgh' ).
write( 'Pittsburgh, PA 15260' ).
write( 'This prolog program illustrates a rule system for kinship terminology ' ).
write( 'that is much more complete than the usual alice and victoria example.' ).
write( 'It has been illustrated on a data base of the descent of English kings ' ).
write( 'taken from An Encyclopedia of World History, edited by William Langer.' ).
write( 'The page numbers refer to geneological tables in that text' ).
write( 'One could just as easily substitute ones own family for the kings.' ).
write( 'This program would be improved by replacing numbers for each individual' ).
write( 'and defining a name operator that assigned the appropriate name to the' ).
write( 'number, as in name_of(1,william_the_conqueror)' ).
write( 'This is because many of the names of women were omitted in my source ' ).
write( 'and were entered only as x. This leads to problems in searching out ' ).
write( 'some of the kin relationships in this data base. ' ).
write( 'p371' ).
parents(james_I,henry_stuart_lord_darnley,mary_queen_of_Scots).
parents(arabella_stuart,charles_stuart_earl_of_Lenox,x).
parents(william_seymour,edward_lord_beauchamp,x).
parents(edward_lord_beauchamp,edward_seymour_earl_of_Hertford,catherine_grey).
parents(mary_queen_of_scots,james_V_of_Scotland,mary_of_Lorraine).
parents(henry_stuart_lord_darnley,matthew_stuart_earl_of_Lenox,margaret_douglas).
parents(charles_stuart_earl_of_Lenox,matthew_stuart_earl_of_Lenox,margaret_douglas).
parents(lady_jane_grey,henry_grey_duke_of_Suffolk,frances_brandon).
parents(catherine_grey,henry_grey_duke_of_Suffolk,frances_brandon).
parents(margaret,earl_of_Cumberland,eleanor_brandon).
parents(james_V_of_Scotland,james_IV_of_Scotland,margaret_tudor).
parents(margaret_douglas,archibald_douglas_earl_of_Angus,margaret_tudor).
parents(frances_brandon,charles_brandon_duke_of_Suffolk,mary_tudor).
parents(eleanor_brandon,charles_brandon_duke_of_Suffolk,mary_tudor).
parents(mary_tudor_2,henry_VIII,catharine_of_Aragon).
parents(elizabeth_I,henry_VIII,anne_boleyn).
parents(edward_VI,henry_VIII,jane_seymour).
parents(arthur_tudor,henry_VII,elizabeth).
parents(henry_VIII,henry_VII,elizabeth).
parents(margaret_tudor,henry_VII,elizabeth).
parents(mary_tudor,henry_VII,elizabeth).
write( 'p269' ).
parents(edward,henry_VI,margaret_of_Anjou).
parents(henry_VII,edmund_tudor_earl_of_richmond,margaret).
parents(elizabeth,edward_IV,x).
parents(edward_V,edward_IV,x).
parents(richard_of_York,edward_IV,x).
parents(henry_VI,henry_V,catharine_of_France).
parents(edmund_tudor_earl_of_richmond,owen_tudor_earl_of_Richmond,catharine_of_France).
parents(margaret,john_beaufort_duke_of_Somerset,x).
parents(edward_IV,richard_duke_of_York,anne_d_of_roger_mortimer_jr).
parents(richard_III,richard_duke_of_York,anne_d_of_roger_mortimer_jr).
parents(george_duke_of_Clarence,richard_duke_of_York,anne_d_of_roger_mortimer_jr).
parents(edmund,roger_mortimer_jr,x).
parents(anne_d_of_roger_mortimer_jr,roger_mortimer_jr,x).
parents(henry_V,henry_IV,x).
parents(thomas_duke_of_Gloucester,henry_IV,x).
parents(john_duke_of_Bedford,henry_IV,x).
parents(humphrey_duke_of_Gloucester,henry_IV,x).
parents(john_beaufort_duke_of_Somerset,john_beaufort,x).
parents(richard_duke_of_York,richard_earl_of_Cambridge,x).
parents(roger_mortimer_jr,roger_mortimer_sr,phillippa).
parents(richard_II,edward_the_Black_Prince,x).
parents(phillippa,lionel_duke_of_Clarence,x).
parents(henry_IV,john_of_Gaunt_duke_of_Lancaster,blanche).
parents(john_beaufort,john_of_Gaunt_duke_of_Lancaster,catherine_swynford).
parents(edward_duke_of_York,edmund_duke_of_York,x).
parents(richard_earl_of_Cambridge,edmund_duke_of_York,x).
parents(edward_the_Black_Prince,edward_III,x).
parents(william,edward_III,x).
parents(lionel_duke_of_Clarence,edward_III,x).
parents(john_of_Gaunt_duke_of_Lancaster,edward_III,x).
parents(edmund_duke_of_York,edward_III,x).
parents(thomas_duke_of_Gloucester,edward_III,x).
parents(edward_III,edward_II,isabella_of_France).
write( 'p195' ).
parents(joan,edward_I,eleanor_of_Castile).
parents(margaret_m_john_II_of_Brabant,edward_I,eleanor_of_Castile).
parents(elizabeth_m_humphrey_of_Hereford,edward_I,eleanor_of_Castile).
parents(edward_II,edward_I,eleanor_of_Castile).
parents(thomas,edward_I,margaret_of_France).
parents(edmund,edward_I,margaret_of_France).
parents(edward_I,henry_III,eleanor_of_Provence).
parents(margaret_m_alexander_III_of_Scotland,henry_III,eleanor_of_Provence).
parents(edmund,henry_III,eleanor_of_Provence).
parents(henry_III,john_Lackland,isabella_of_Angouleme).
parents(richard_of_Cornwall,john_Lackland,isabella_of_Angouleme).
parents(henry,henry_II,eleanor_of_Aquitaine).
parents(richard_I_Coeur_de_Lion,henry_II,eleanor_of_Aquitaine).
parents(geoffrey,henry_II,eleanor_of_Aquitaine).
parents(john_Lackland,henry_II,eleanor_of_Aquitaine).
parents(arthur,geoffrey,x).
parents(henry_II,geoffrey_of_Anjou_Plantagenet,matilda).
parents(matilda,henry_I,matilda_of_Scotland).
parents(robert,william_I_the_Conqueror,matilda_of_Flanders).
parents(willaim_II_Rufus,william_I_the_Conqueror,matilda_of_Flanders).
parents(henry_I,william_I_the_Conqueror,matilda_of_Flanders).
parents(adele,william_I_the_Conqueror,matilda_of_Flanders).
parents(stephen,stephen_of_Blois,adele).
same(X,X) :- atom(X).
diff(X,Y) :- not(same(X,Y)).
mother_of(X,Y) :- parents(Y,Z,X).
father_of(X,Y) :- parents(Y,X,Z).
married(X,Y) :- parents(Z,X,Y).
incest(X,Y) :- married(X,Y), sister_of(Y,X).
incest(X,Y) :- married(X,Y), mother_of(Y,X).
incest(X,Y) :- married(X,Y), father_of(X,Y).
incest(X,Y) :- married(X,Y), brother_of(X,Y).
female(X) :- mother_of(X,Y).
male(X) :- father_of(X,Y).
no_sex(X) :- atom(X),
not(male(X)),
not(female(X)),
true.
parent_of(X,Y) :- mother_of(X,Y).
parent_of(X,Y) :- father_of(X,Y).
child_of(X,Y) :- parent_of(Y,X).
ancestor_of(X,Y) :-
parent_of(X,Y).
ancestor_of(X,Y) :-
parent_of(W,Y),
ancestor_of(X,W).
descendent_of(X,Y) :-
ancestor_of(Y,X).
sister_of(X,Y) :-
female(X),
parents(X,M,F),
parents(Y,M,F),
diff(X,Y),
true.
brother_of(X,Y) :-
male(X),
parents(X,M,F),
parents(Y,M,F),
diff(X,Y),
true.
sibling_of(X,Y) :-
brother_of(X,Y).
sibling_of(X,Y) :-
sister_of(X,Y).
p_half_sister_of(X,Y) :-
female(X),
parents(X,M,Z),
parents(Y,M,W),
diff(Z,W),
true.
m_half_sister_of(X,Y) :-
female(X),
parents(X,Z,F),
parents(Y,W,F),
diff(Z,W),
true.
half_sister_of(X,Y) :- p_half_sister_of(X,Y).
half_sister_of(X,Y) :- m_half_sister_of(X,Y).
p_half_brother_of(X,Y) :-
male(X),
parents(X,M,Z),
parents(Y,M,W),
diff(Z,W),
true.
m_half_brother_of(X,Y) :-
male(X),
parents(X,Z,F),
parents(Y,W,F),
diff(Z,W),
true.
half_brother_of(X,Y) :- p_half_brother_of(X,Y).
half_brother_of(X,Y) :- m_half_brother_of(X,Y).
half_sibling_of(X,Y) :-
half_sister_of(X,Y).
half_sibling_of(X,Y) :-
half_brother_of(X,Y).
p_aunt_of(X,Y) :-
parents(Y,M,F),
sister_of(X,M).
m_aunt_of(X,Y) :-
parents(Y,M,F),
sister_of(X,F).
aunt_of(X,Y) :- p_aunt_of(X,Y).
aunt_of(X,Y) :- m_aunt_of(X,Y).
p_uncle_of(X,Y) :-
parents(Y,M,F),
brother_of(X,M).
m_uncle_of(X,Y) :-
parents(Y,M,F),
brother_of(X,F).
uncle_of(X,Y) :- p_uncle_of(X,Y).
uncle_of(X,Y) :- m_uncle_of(X,Y).
nuncle_of(X,Y) :- aunt_of(X,Y).
nuncle_of(X,Y) :- uncle_of(X,Y).
half_aunt_of(X,Y) :-
parents(Y,M,F),
half_sister_of(X,M).
half_aunt_of(X,Y) :-
parents(Y,M,F),
half_sister_of(X,F).
half_uncle_of(X,Y) :-
parents(Y,M,F),
half_brother_of(X,M).
half_uncle_of(X,Y) :-
parents(Y,M,F),
half_brother_of(X,F).
half_nuncle_of(X,Y) :-
half_uncle_of(X,Y).
half_nuncle_of(X,Y) :-
half_aunt_of(X,Y).
cousin_of(X,Y) :-
nuncle_of(Z,X),
child_of(Y,Z).
half_cousin_of(X,Y) :-
half_nuncle(Z,X),
child_of(Y,Z).
pp_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
sibling_of(A,C).
pc_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
sibling_of(A,D).
mc_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
sibling_of(B,C).
mp_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
sibling_of(B,D).
parallel_cousin_of(X,Y) :-
pp_cousin_of(X,Y).
parallel_cousin_of(X,Y) :-
mp_cousin_of(X,Y).
cross_cousin_of(X,Y) :-
pc_cousin_of(X,Y).
cross_cousin_of(X,Y) :-
mc_cousin_of(X,Y).
pp_half_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
half_sibling_of(A,C).
pc_half_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
half_sibling_of(A,D).
mc_half_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
half_sibling_of(B,C).
mp_half_cousin_of(X,Y) :-
parents(X,A,B),
parents(Y,C,D),
half_sibling_of(B,D).
half_cousin_of(X,Y) :-
pp_half_cousin_of(X,Y),
pc_half_cousin_of(X,Y),
mc_half_cousin_of(X,Y),
mp_half_cousin_of(X,Y).
half_parallel_cousin_of(X,Y) :-
pp_half_cousin_of(X,Y),
mp_half_cousin_of(X,Y).
half_cross_cousin_of(X,Y) :-
pc_half_cousin_of(X,Y),
mc_half_cousin_of(X,Y).
any_cousin_of(X,Y) :-
ancestor_of(Z,X),
ancestor_of(W,Y),
sibling_of(Z,W).